<%--
   processRelation
   Copyright (c) 2013 ISPERP
   Version : 1.0.0
 --%>
<%@tag import="itsm.isperp.framework.core.context.ContextHolder"%>
<%@tag import="itsm.isperp.framework.utils.Pair"%>
<%@tag import="itsm.isperp.module.service.bpm.BpmProcessRelationService"%>
<%@ tag language="java" pageEncoding="UTF-8"
	trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ attribute name="businessKey" required="true" rtexprvalue="true"
	type="java.lang.String" description="业务表的Key"%>

<script type="text/javascript">
<!--
	function bpmProcessRelationTrace_onClick(event, treeId, treeNode) {
		if (treeNode.treenodePath) {
			isperp.openDialog({
				modal : false,
				"contentUrl" : "workflow/processRun/view?id=" + treeNode.id + "&processKey=" + treeNode.treenodePath
			});
		}
	}
//-->
</script>

<%
	BpmProcessRelationService bpmProcessRelationService = ContextHolder
			.getSpringBean("bpmProcessRelationService");
	Pair<Boolean, Boolean> pa = bpmProcessRelationService
			.getRelation(businessKey);

	if (pa.getLeftObject() || pa.getRightObject()) {
%>
<%
	}

	if (pa.getRightObject()) {
%>

<div style="float:left">
	<isperp:tree modal="false" id="bpmProcessRelationTreeUp">
		<isperp:async enable="true" autoParam="'id'"
			otherParam="{asyncLoad:1}"
			url="bpm/processRelation/getRelationTree?way=0&rootId=${businessKey }">
		</isperp:async>
		<isperp:callback onClick="bpmProcessRelationTrace_onClick">
		</isperp:callback>
	</isperp:tree>
</div>
<%
	}
	if (pa.getLeftObject()) {
%>
<div style="float:left">
	<isperp:tree modal="false" id="bpmProcessRelationTreeDown"
		cusEditUrl="workflow/processRun/entry">
		<isperp:async enable="true" autoParam="'id'"
			otherParam="{asyncLoad:1}"
			url="bpm/processRelation/getRelationTree?way=1&rootId=${businessKey }">
		</isperp:async>
		<isperp:callback onClick="bpmProcessRelationTrace_onClick">
		</isperp:callback>
	</isperp:tree>
</div>
<%
	}
%>
